<?php


function find_user_preferences(&$simple_xml_object) {
    $pref_array = array();

    //first load the defaults
    foreach ($simple_xml_object->UserPref as $pref) {
        $pref_array["{$pref['name']}"] = "{$pref['default_value']}";
    }


    //TODO: load custom user preferences

    return $pref_array;
}

function load_user_preferences(&$simple_xml_object) {
    $pref_array = find_user_preferences($simple_xml_object);
   //now pass the preferences off the the translater
    foreach ($pref_array as $key => $pref) {
        set_user_preference($key, $pref);
    }
}
